library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ tibble 3.1.0 ✓ purrr 0.3.4
## ✓ tidyr 1.1.3 ✓ stringr 1.4.0
## ✓ readr 1.4.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(arsenal)
library(data.table)
##
## Attaching package: 'data.table'
## The following object is masked from 'package:purrr':
##
## transpose
## The following objects are masked from 'package:dplyr':
##
## between, first, last
sleephygiene <- read_csv("/Users/Ivanics/Desktop/SPH/3rd term/Health Communication Programs I/Stats/Sleep Hygiene Survey_March 10, 2021_19.38 2.csv")
## Warning: Duplicated column names deduplicated: 'Q37' => 'Q37_1' [64]
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## .default = col_character()
## )
## ℹ Use `spec()` for the full column specifications.
sleephygiene$StartDate <- lubridate::ymd_hms(sleephygiene$StartDate)
## Warning: 2 failed to parse.
#Filter to include only responses beyond this time
sleephygiene <- sleephygiene %>% filter(StartDate >= "2021-03-09 18:00:00")
#Select out the variables we need
sleephygiene <- sleephygiene %>% select(Progress, `Duration (in seconds)`, Finished, LocationLatitude, LocationLongitude, DistributionChannel, UserLanguage, Q1, Q2, Q3, Q2_5_TEXT, Q4, Q5, Q6, Q37, Q38, Q39, Q7, Q8, Q8_3_TEXT, Q10, Q11, Q9, Q13, Q13, Q14_10, Q14_11, Q15, Q16_4, Q16_5, Q49, Q42, Q42_10_TEXT, Q19, Q17_NPS_GROUP, Q17, Q36, Q36_6_TEXT, Q18, Q20, Q9, Q13, Q14_10, Q14_11, Q15, Q16_4, Q16_5, Q49, Q42, Q42_10_TEXT, Q19, Q12_1, Q17_NPS_GROUP, Q17, Q36, Q36_6_TEXT, Q18, Q20, Q44_1, Q44_2, Q44_3, Q44_4, Q44_5, Q44_6, Q44_7, Q44_8, Q44_9, Q59_1, Q59_2, Q59_2, Q59_3, Q59_4, Q37_1, Q33, Q50_1, Q50_2, Q50_3, Q50_4, Q50_5, Q50_6, Q50_7, Q53_1, Q53_2, Q53_3, Q53_4, Q53_5, Q48, Q48_5_TEXT, Q52, `Q5 - Topics`, `Q5 - Parent Topics`)
sleephygiene <- rowid_to_column(sleephygiene, "ID")
#Variable 14
sleephygiene$Q14_10_new_hours <- sub(":.*", "", sleephygiene$Q14_10)
sleephygiene$Q14_10_new_hours <- ifelse(nchar(sleephygiene$Q14_10_new_hours)==3, (str_extract(sleephygiene$Q14_10_new_hours, "^\\d{1}")), sleephygiene$Q14_10_new_hours)
sleephygiene$Q14_10_new_hours <- ifelse(nchar(sleephygiene$Q14_10_new_hours)==4, (str_extract(sleephygiene$Q14_10_new_hours, "^\\d{1}")), sleephygiene$Q14_10_new_hours)
sleephygiene$Q14_10_new_minutes <- str_extract(sleephygiene$Q14_10, "(?<=:)[0-9]*")
sleephygiene$Q14_10_new_minutes <- ifelse(is.na(sleephygiene$Q14_10_new_minutes) & !is.na(sleephygiene$Q14_10_new_hours), "00", sleephygiene$Q14_10_new_minutes)
sleephygiene$Q14_10_new_hours <- as.numeric(sleephygiene$Q14_10_new_hours)
sleephygiene$Q14_10_new_minutes <- ifelse(grepl("[0-9]+", sleephygiene$Q14_11), sleephygiene$Q14_11, sleephygiene$Q14_10_new_minutes)
sleephygiene$Q14_10_new_hours <- ifelse(grepl("[pP][mM]", sleephygiene$Q14_11), sleephygiene$Q14_10_new_hours+12, sleephygiene$Q14_10_new_hours)
sleephygiene$Q14_10_new_hours <- as.character(sleephygiene$Q14_10_new_hours)
#Variable 16
sleephygiene$Q16_4_new_hours <- sub(":.*", "", sleephygiene$Q16_4)
sleephygiene$Q16_4_new_hours <- ifelse(nchar(sleephygiene$Q16_4_new_hours)==3, (str_extract(sleephygiene$Q16_4_new_hours, "^\\d{1}")), sleephygiene$Q16_4_new_hours)
sleephygiene$Q16_4_new_hours <- ifelse(nchar(sleephygiene$Q16_4_new_hours)==4, (str_extract(sleephygiene$Q16_4_new_hours, "^\\d{1}")), sleephygiene$Q16_4_new_hours)
sleephygiene$Q16_4_new_minutes <- str_extract(sleephygiene$Q16_5, "(?<=:)[0-9]*")
sleephygiene$Q16_4_new_minutes <- ifelse(is.na(sleephygiene$Q16_4_new_minutes) & !is.na(sleephygiene$Q16_4_new_hours), "00", sleephygiene$Q16_4_new_minutes)
sleephygiene$Q16_4_new_hours <- as.numeric(sleephygiene$Q16_4_new_hours)
sleephygiene$Q16_4_new_minutes <- ifelse(grepl("[0-9]+", sleephygiene$Q16_5), sleephygiene$Q16_5, sleephygiene$Q16_4_new_minutes)
sleephygiene$Q16_4_new_hours <- ifelse(grepl("[pP][mM]", sleephygiene$Q16_5), sleephygiene$Q16_4_new_hours+12, sleephygiene$Q16_4_new_hours)
sleephygiene$Q16_4_new_hours <- as.character(sleephygiene$Q16_4_new_hours)
#Create a sleeptime and wakeup variable
sleephygiene <- sleephygiene %>%
mutate(Q14_wakeuptime =
case_when(!is.na(Q14_10_new_hours) ~ paste0(Q14_10_new_hours,":",Q14_10_new_minutes),
TRUE ~ NA_character_)) %>%
mutate(Q16_sleeptime =
case_when(!is.na(Q16_4_new_hours) ~ paste0(Q16_4_new_hours,":",Q16_4_new_minutes),
TRUE ~ NA_character_))
sleephygiene$Q14_wakeuptime <- as.POSIXct(sleephygiene$Q14_wakeuptime, format="%H:%M")
sleephygiene$Q16_sleeptime <- as.POSIXct(sleephygiene$Q16_sleeptime, format="%H:%M")
#General factor recoding
sleephygiene <- sleephygiene %>% mutate(
Q1_consent = factor(Q1)) %>%
mutate(Q2_program = factor(Q2)) %>%
mutate(Q3_role = factor(Q3)) %>%
mutate(Q4_gender = factor(Q4)) %>%
mutate(Q5_age = as.numeric(Q5)) %>%
mutate(Q6_numberinhousehold = as.numeric(Q6)) %>%
mutate(Q37_employed = factor(Q37)) %>%
mutate(Q38_wfh = factor(Q38)) %>%
mutate(Q39_dayornight = factor(Q39)) %>%
mutate(Q7_children = factor(Q7)) %>%
mutate(Q8_diagnosis = factor(Q8)) %>%
mutate(Q10_workdayhoursofsleep = as.numeric(Q10)) %>%
mutate(Q11_weekendhoursofsleep = as.numeric(Q11)) %>%
mutate(Q9_howoftensleepy = factor(Q9)) %>%
mutate(Q13_consistentwakeup = factor(Q13)) %>%
mutate(Q15_consistentbedtimeonweekdays = factor(Q15)) %>%
mutate(Q49_sleepqualitychangecovid = factor(Q49)) %>%
mutate(Q18_howoftenpracticemindfullness = factor(Q18)) %>%
mutate(Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep = factor(Q44_1)) %>%
mutate(Q44_2_gettingagoodnightssleepisimportantome = factor(Q44_2)) %>%
mutate(Q44_3_mostofmyfriendshaveahealthysleeproutine = factor(Q44_3)) %>%
mutate(Q44_4_lackofsleepaffectsmyacademicperformance = factor(Q44_4)) %>%
mutate(Q44_5_havingaregularsleeproutineimprovesmentalclariy = factor(Q44_5)) %>%
mutate(Q44_6_ifeelpositiveaboutthequalityofmysleep = factor(Q44_6)) %>%
mutate(Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep = factor(Q44_7)) %>%
mutate(Q44_8_ithinkingworkingoutregularlyleadstobettersleep = factor(Q44_8)) %>%
mutate(Q44_9_ithinkmeditatingbeforesleephelpsquality = factor(Q44_9)) %>%
mutate(Q59_1_icanmaintainhealthysleephabits = factor(Q59_1)) %>%
mutate(Q59_2_icancutoutscreenuseonehourbeforesleep = factor(Q59_2)) %>%
mutate(Q59_3_icanworkoutregularly = factor(Q59_3)) %>%
mutate(Q59_4_icanmediatebeforebed = factor(Q59_4)) %>%
mutate(Q37_whatdoyouconsideragoodnightssleep = factor(Q37))
#Q19
sleephygiene$Q19_howmanyhourssdidyouuseascreen <- str_extract(sleephygiene$Q19, '\\d+')
#Q12
sleephygiene$Q12_1_howmanynightsusescreen <- as.numeric(sleephygiene$Q12_1)
#Q17
sleephygiene$Q17_stressedaboutschool <- as.numeric(sleephygiene$Q17)
#Q33
#Come back to this one because some are given as a range
sleephygiene$Q33_whatisthrecommendednumbersofhoursofsleep <- str_extract(sleephygiene$Q33, '\\d+')
sleephygiene$Q33_whatisthrecommendednumbersofhoursofsleep <- as.numeric(sleephygiene$Q33_whatisthrecommendednumbersofhoursofsleep)
#Q50
sleephygiene <- sleephygiene %>%
mutate(Q50_1_energyfordailyacitivites = as.numeric(Q50_1)) %>%
mutate(Q50_2_attractivness = as.numeric(Q50_2)) %>%
mutate(Q50_3_productivity = as.numeric(Q50_3)) %>%
mutate(Q50_4_accomplishmentofotherdailygoals = as.numeric(Q50_4)) %>%
mutate(Q50_5_mentalandemotionalwellbeing = as.numeric(Q50_5)) %>%
mutate(Q50_6_fosteringmaintaingrelationships = as.numeric(Q50_6)) %>%
mutate(Q50_7_caringforchildren = as.numeric(Q50_7))
#Q53
sleephygiene <- sleephygiene %>%
mutate(Q53_1_getoutsidefor10mininthemorning = as.numeric(Q53_1)) %>%
mutate(Q53_2_exerciseduringtheday = as.numeric(Q53_2)) %>%
mutate(Q53_3_doingabreathingexercisebeforesleep = as.numeric(Q53_3)) %>%
mutate(Q53_4_notusescreens = as.numeric(Q53_4)) %>%
mutate(Q53_5_listeningtoacalmingaudiobookorpodcast = as.numeric(Q53_5))
#Q42
resp.split_42 <- strsplit(sleephygiene$Q42, ",")
lev <- unique(unlist(resp.split_42))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_42, function(x) table(factor(x, levels=lev))))))
sleephygiene <- sleephygiene %>%
mutate(bedtimeroutine = case_when(
Washing.my.face == 1 ~ "Washing my face",
Brushing.teeth == 1 ~ "Brushing teeth",
Showering == 1 ~ "Showering",
Reading == 1 ~ "Reading",
Journaling == 1 ~ "Journaling",
Meditating == 1 ~ "Meditating",
Watching.TV == 1 ~ "Watching TV",
Phone.Usage == 1 ~ "Phone usage",
Listening.to.Music == 1 ~ "Listening to music",
Other == 1 ~ "Other"))
#Q36
resp.split_36 <- strsplit(sleephygiene$Q36, ",")
lev <- unique(unlist(resp.split_36))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_36, function(x) table(factor(x, levels=lev))))))
sleephygiene <- sleephygiene %>%
mutate(cantsleepfeeling = case_when(
Guilty == 1 ~ "Guilty",
Angry == 1 ~ "Angry",
Frustrated == 1 ~ "Frustrated",
Sad == 1 ~ "Sad",
Stressed == 1 ~ "Stressed",
None.of.the.above == 1 ~ "None of the above",
Other.1 == 1 ~ "Other"))
#Q20
resp.split_20 <- strsplit(sleephygiene$Q20, ",")
lev <- unique(unlist(resp.split_20))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_20, function(x) table(factor(x, levels=lev))))))
sleephygiene <- sleephygiene %>%
mutate(behaviors = case_when(
Cigarette.Smoking == 1 ~ "Cigarette smoking",
Alcohol.Consumption == 1 ~ "Alcohol Consumption",
Exercise == 1 ~ "Exercise",
Social.Media.Use == 1 ~ "Social Media Use",
Daytime.Napping == 1 ~ "Daytime napping",
Drinking.Caffeinated.beverages == 1 ~ "Drinking Caffeinated beverages",
Using.Sleep.Aids..ex..melatonin == 1 ~ "Using Sleep Aids ex. melatonin"))
#48
resp.split_48 <- strsplit(sleephygiene$Q48, ",")
lev <- unique(unlist(resp.split_48))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_48, function(x) table(factor(x, levels=lev))))))
sleephygiene <- sleephygiene %>%
mutate(information = case_when(
Health.care.professional == 1 ~ "Health care professional",
Social.media == 1 ~ "Social media",
Other.online.source == 1 ~ "Other online source",
News.sources == 1 ~ "News sources",
Friends == 1 ~ "Friends",
University.wellbeing.resources..Office.of.Wellness.and.Health.Promotion == 1 ~ "University.wellbeing.resources..Office.of.Wellness.and.Health.Promotion"))
Plots for wakeup and sleep times
ggplot(data=sleephygiene, aes(y=Q14_wakeuptime,x=ID)) +
geom_point() +
theme_test()#+
## Warning: Removed 12 rows containing missing values (geom_point).
#xlim(as.POSIXct(c("2021-03-10 05:00:00", "2021-03-10 12:00:00")))
#Plot for sleeptime
ggplot(data=sleephygiene, aes(y=Q16_sleeptime,x=ID)) +
geom_point() +
theme_test()
## Warning: Removed 22 rows containing missing values (geom_point).
#Tab 1
attach(sleephygiene)
tab1 <- tableby(~ Q3_role +
Q4_gender +
Q5_age +
Q6_numberinhousehold +
Q37_employed +
Q8_diagnosis +
Q10_workdayhoursofsleep +
Q11_weekendhoursofsleep +
Q9_howoftensleepy,
data=sleephygiene, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
| Overall (N=41) | |
|---|---|
| Q3_role | |
| Â Â Â N-Miss | 1 |
| Â Â Â Faculty/Staff Member | 1 (2.5%) |
| Â Â Â Full-time student | 39 (97.5%) |
| Q4_gender | |
| Â Â Â N-Miss | 1 |
| Â Â Â Female | 35 (87.5%) |
| Â Â Â Male | 3 (7.5%) |
| Â Â Â Non-binary / third gender | 2 (5.0%) |
| Q5_age | |
| Â Â Â Median (Q1, Q3) | 28.00 (24.00, 30.00) |
| Q6_numberinhousehold | |
| Â Â Â Median (Q1, Q3) | 2.00 (1.00, 3.00) |
| Q37_employed | |
| Â Â Â N-Miss | 1 |
| Â Â Â No | 25 (62.5%) |
| Â Â Â Yes | 15 (37.5%) |
| Q8_diagnosis | |
| Â Â Â N-Miss | 1 |
| Â Â Â Insomnia | 1 (2.5%) |
| Â Â Â No | 38 (95.0%) |
| Â Â Â Sleep Apnea | 1 (2.5%) |
| Q10_workdayhoursofsleep | |
| Â Â Â Median (Q1, Q3) | 7.00 (6.00, 8.00) |
| Q11_weekendhoursofsleep | |
| Â Â Â Median (Q1, Q3) | 8.00 (7.00, 9.00) |
| Q9_howoftensleepy | |
| Â Â Â N-Miss | 1 |
| Â Â Â Always | 1 (2.5%) |
| Â Â Â Rarely | 7 (17.5%) |
| Â Â Â Sometimes | 23 (57.5%) |
| Â Â Â Very Often | 9 (22.5%) |
#If student
student <- sleephygiene %>% filter(Q3_role != "Faculty/Staff Member")
tab1 <- tableby(~ Q2_program,
data=student, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
| Overall (N=39) | |
|---|---|
| Q2_program | |
| Â Â Â Doctoral Student | 17 (43.6%) |
| Â Â Â Masters Student | 21 (53.8%) |
| Â Â Â Post doctoral student | 1 (2.6%) |
#If employed
employed <- sleephygiene %>% filter(Q37_employed == "Yes")
tab1 <- tableby(~ Q38_wfh,
data=employed, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
| Overall (N=15) | |
|---|---|
| Q38_wfh | |
| Â Â Â No | 3 (20.0%) |
| Â Â Â Yes | 12 (80.0%) |
#If wfh
notworkfromhome <- sleephygiene %>% filter(Q37_employed == "Yes" & Q38_wfh == "No")
tab1 <- tableby(~ Q39_dayornight,
data=notworkfromhome, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
| Overall (N=3) | |
|---|---|
| Q39_dayornight | |
| Â Â Â Day shift | 2 (66.7%) |
| Â Â Â Night shift | 1 (33.3%) |
tab1 <- tableby(~ Q13_consistentwakeup +
Q15_consistentbedtimeonweekdays +
Q49_sleepqualitychangecovid +
bedtimeroutine +
Q19_howmanyhourssdidyouuseascreen +
Q12_1_howmanynightsusescreen +
Q17_stressedaboutschool +
cantsleepfeeling +
Q18_howoftenpracticemindfullness +
behaviors +
Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep +
Q44_2_gettingagoodnightssleepisimportantome +
Q44_3_mostofmyfriendshaveahealthysleeproutine +
Q44_4_lackofsleepaffectsmyacademicperformance +
Q44_5_havingaregularsleeproutineimprovesmentalclariy +
Q44_6_ifeelpositiveaboutthequalityofmysleep +
Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep +
Q44_8_ithinkingworkingoutregularlyleadstobettersleep +
Q44_9_ithinkmeditatingbeforesleephelpsquality +
Q59_1_icanmaintainhealthysleephabits +
Q59_2_icancutoutscreenuseonehourbeforesleep +
Q59_3_icanworkoutregularly +
Q59_4_icanmediatebeforebed +
Q37_whatdoyouconsideragoodnightssleep +
Q50_1_energyfordailyacitivites +
Q50_2_attractivness +
Q50_3_productivity +
Q50_4_accomplishmentofotherdailygoals +
Q50_5_mentalandemotionalwellbeing +
Q50_6_fosteringmaintaingrelationships +
Q50_7_caringforchildren +
Q53_1_getoutsidefor10mininthemorning +
Q53_2_exerciseduringtheday +
Q53_3_doingabreathingexercisebeforesleep +
Q53_4_notusescreens +
Q53_5_listeningtoacalmingaudiobookorpodcast +
information,
data=sleephygiene, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 2. Sleep questions', pfootnote=TRUE, digits = 2)
| Overall (N=41) | |
|---|---|
| Q13_consistentwakeup | |
| Â Â Â N-Miss | 1 |
| Â Â Â No | 8 (20.0%) |
| Â Â Â Sometimes | 3 (7.5%) |
| Â Â Â Yes | 29 (72.5%) |
| Q15_consistentbedtimeonweekdays | |
| Â Â Â N-Miss | 1 |
| Â Â Â No | 7 (17.5%) |
| Â Â Â Sometimes | 14 (35.0%) |
| Â Â Â Yes | 19 (47.5%) |
| Q49_sleepqualitychangecovid | |
| Â Â Â N-Miss | 1 |
| Â Â Â No | 19 (47.5%) |
| Â Â Â Yes, I feel my sleep quality has improved | 5 (12.5%) |
| Â Â Â Yes, I feel my sleep quality has worsened | 16 (40.0%) |
| bedtimeroutine | |
| Â Â Â N-Miss | 1 |
| Â Â Â Brushing teeth | 11 (27.5%) |
| Â Â Â Phone usage | 2 (5.0%) |
| Â Â Â Reading | 1 (2.5%) |
| Â Â Â Washing my face | 25 (62.5%) |
| Â Â Â Watching TV | 1 (2.5%) |
| Q19_howmanyhourssdidyouuseascreen | |
| Â Â Â N-Miss | 2 |
| Â Â Â 10 | 13 (33.3%) |
| Â Â Â 11 | 1 (2.6%) |
| Â Â Â 12 | 10 (25.6%) |
| Â Â Â 13 | 1 (2.6%) |
| Â Â Â 14 | 1 (2.6%) |
| Â Â Â 15 | 1 (2.6%) |
| Â Â Â 16 | 1 (2.6%) |
| Â Â Â 17 | 1 (2.6%) |
| Â Â Â 4 | 2 (5.1%) |
| Â Â Â 6 | 2 (5.1%) |
| Â Â Â 7 | 1 (2.6%) |
| Â Â Â 8 | 2 (5.1%) |
| Â Â Â 9 | 3 (7.7%) |
| Q12_1_howmanynightsusescreen | |
| Â Â Â Median (Q1, Q3) | 7.00 (6.00, 7.00) |
| Q17_stressedaboutschool | |
| Â Â Â Median (Q1, Q3) | 7.00 (6.00, 8.00) |
| cantsleepfeeling | |
| Â Â Â N-Miss | 1 |
| Â Â Â Angry | 1 (2.5%) |
| Â Â Â Frustrated | 26 (65.0%) |
| Â Â Â Guilty | 6 (15.0%) |
| Â Â Â None of the above | 1 (2.5%) |
| Â Â Â Other | 1 (2.5%) |
| Â Â Â Sad | 1 (2.5%) |
| Â Â Â Stressed | 4 (10.0%) |
| Q18_howoftenpracticemindfullness | |
| Â Â Â N-Miss | 1 |
| Â Â Â Always | 1 (2.5%) |
| Â Â Â Never | 8 (20.0%) |
| Â Â Â Rarely | 14 (35.0%) |
| Â Â Â Sometimes | 17 (42.5%) |
| behaviors | |
| Â Â Â N-Miss | 2 |
| Â Â Â Alcohol Consumption | 24 (61.5%) |
| Â Â Â Cigarette smoking | 1 (2.6%) |
| Â Â Â Daytime napping | 1 (2.6%) |
| Â Â Â Exercise | 8 (20.5%) |
| Â Â Â Social Media Use | 5 (12.8%) |
| Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep | |
| Â Â Â N-Miss | 1 |
| Â Â Â Neither agree nor disagree | 3 (7.5%) |
| Â Â Â Somewhat agree | 18 (45.0%) |
| Â Â Â Somewhat disagree | 4 (10.0%) |
| Â Â Â Strongly agree | 12 (30.0%) |
| Â Â Â Strongly disagree | 3 (7.5%) |
| Q44_2_gettingagoodnightssleepisimportantome | |
| Â Â Â N-Miss | 1 |
| Â Â Â Neither agree nor disagree | 2 (5.0%) |
| Â Â Â Somewhat agree | 4 (10.0%) |
| Â Â Â Strongly agree | 33 (82.5%) |
| Â Â Â Strongly disagree | 1 (2.5%) |
| Q44_3_mostofmyfriendshaveahealthysleeproutine | |
| Â Â Â N-Miss | 1 |
| Â Â Â Neither agree nor disagree | 19 (47.5%) |
| Â Â Â Somewhat agree | 9 (22.5%) |
| Â Â Â Somewhat disagree | 7 (17.5%) |
| Â Â Â Strongly agree | 1 (2.5%) |
| Â Â Â Strongly disagree | 4 (10.0%) |
| Q44_4_lackofsleepaffectsmyacademicperformance | |
| Â Â Â N-Miss | 1 |
| Â Â Â Neither agree nor disagree | 2 (5.0%) |
| Â Â Â Somewhat agree | 20 (50.0%) |
| Â Â Â Somewhat disagree | 1 (2.5%) |
| Â Â Â Strongly agree | 16 (40.0%) |
| Â Â Â Strongly disagree | 1 (2.5%) |
| Q44_5_havingaregularsleeproutineimprovesmentalclariy | |
| Â Â Â N-Miss | 1 |
| Â Â Â Somewhat agree | 13 (32.5%) |
| Â Â Â Strongly agree | 27 (67.5%) |
| Q44_6_ifeelpositiveaboutthequalityofmysleep | |
| Â Â Â N-Miss | 1 |
| Â Â Â Neither agree nor disagree | 5 (12.5%) |
| Â Â Â Somewhat agree | 17 (42.5%) |
| Â Â Â Somewhat disagree | 10 (25.0%) |
| Â Â Â Strongly agree | 5 (12.5%) |
| Â Â Â Strongly disagree | 3 (7.5%) |
| Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep | |
| Â Â Â N-Miss | 1 |
| Â Â Â Neither agree nor disagree | 8 (20.0%) |
| Â Â Â Somewhat agree | 18 (45.0%) |
| Â Â Â Somewhat disagree | 1 (2.5%) |
| Â Â Â Strongly agree | 11 (27.5%) |
| Â Â Â Strongly disagree | 2 (5.0%) |
| Q44_8_ithinkingworkingoutregularlyleadstobettersleep | |
| Â Â Â N-Miss | 1 |
| Â Â Â Neither agree nor disagree | 2 (5.0%) |
| Â Â Â Somewhat agree | 12 (30.0%) |
| Â Â Â Strongly agree | 26 (65.0%) |
| Q44_9_ithinkmeditatingbeforesleephelpsquality | |
| Â Â Â N-Miss | 1 |
| Â Â Â Neither agree nor disagree | 15 (37.5%) |
| Â Â Â Somewhat agree | 12 (30.0%) |
| Â Â Â Somewhat disagree | 1 (2.5%) |
| Â Â Â Strongly agree | 9 (22.5%) |
| Â Â Â Strongly disagree | 3 (7.5%) |
| Q59_1_icanmaintainhealthysleephabits | |
| Â Â Â N-Miss | 1 |
| Â Â Â Extremely confident | 4 (10.0%) |
| Â Â Â Pretty confident | 16 (40.0%) |
| Â Â Â Slightly confident | 5 (12.5%) |
| Â Â Â Somewhat confident | 15 (37.5%) |
| Q59_2_icancutoutscreenuseonehourbeforesleep | |
| Â Â Â N-Miss | 1 |
| Â Â Â Extremely confident | 3 (7.5%) |
| Â Â Â Not at all confident | 7 (17.5%) |
| Â Â Â Pretty confident | 8 (20.0%) |
| Â Â Â Slightly confident | 14 (35.0%) |
| Â Â Â Somewhat confident | 8 (20.0%) |
| Q59_3_icanworkoutregularly | |
| Â Â Â N-Miss | 1 |
| Â Â Â Extremely confident | 10 (25.0%) |
| Â Â Â Not at all confident | 2 (5.0%) |
| Â Â Â Pretty confident | 8 (20.0%) |
| Â Â Â Slightly confident | 6 (15.0%) |
| Â Â Â Somewhat confident | 14 (35.0%) |
| Q59_4_icanmediatebeforebed | |
| Â Â Â N-Miss | 1 |
| Â Â Â Extremely confident | 5 (12.5%) |
| Â Â Â Not at all confident | 9 (22.5%) |
| Â Â Â Pretty confident | 5 (12.5%) |
| Â Â Â Slightly confident | 9 (22.5%) |
| Â Â Â Somewhat confident | 12 (30.0%) |
| Q37_whatdoyouconsideragoodnightssleep | |
| Â Â Â N-Miss | 1 |
| Â Â Â No | 25 (62.5%) |
| Â Â Â Yes | 15 (37.5%) |
| Q50_1_energyfordailyacitivites | |
| Â Â Â Median (Q1, Q3) | 5.00 (4.00, 5.00) |
| Q50_2_attractivness | |
| Â Â Â Median (Q1, Q3) | 3.00 (2.00, 4.00) |
| Q50_3_productivity | |
| Â Â Â Median (Q1, Q3) | 5.00 (4.00, 5.00) |
| Q50_4_accomplishmentofotherdailygoals | |
| Â Â Â Median (Q1, Q3) | 4.00 (4.00, 5.00) |
| Q50_5_mentalandemotionalwellbeing | |
| Â Â Â Median (Q1, Q3) | 5.00 (4.00, 5.00) |
| Q50_6_fosteringmaintaingrelationships | |
| Â Â Â Median (Q1, Q3) | 4.00 (3.00, 5.00) |
| Q50_7_caringforchildren | |
| Â Â Â Median (Q1, Q3) | 1.00 (1.00, 1.50) |
| Q53_1_getoutsidefor10mininthemorning | |
| Â Â Â Median (Q1, Q3) | 4.00 (2.00, 5.00) |
| Q53_2_exerciseduringtheday | |
| Â Â Â Median (Q1, Q3) | 4.00 (3.00, 5.00) |
| Q53_3_doingabreathingexercisebeforesleep | |
| Â Â Â Median (Q1, Q3) | 3.00 (2.00, 4.25) |
| Q53_4_notusescreens | |
| Â Â Â Median (Q1, Q3) | 3.00 (2.00, 3.25) |
| Q53_5_listeningtoacalmingaudiobookorpodcast | |
| Â Â Â Median (Q1, Q3) | 3.00 (2.00, 4.00) |
| information | |
| Â Â Â N-Miss | 2 |
| Â Â Â Friends | 1 (2.6%) |
| Â Â Â Health care professional | 16 (41.0%) |
| Â Â Â News sources | 1 (2.6%) |
| Â Â Â Other online source | 5 (12.8%) |
| Â Â Â Social media | 12 (30.8%) |
| Â Â Â University.wellbeing.resources..Office.of.Wellness.and.Health.Promotion | 4 (10.3%) |
attach(sleephygiene)
## The following objects are masked from sleephygiene (pos = 3):
##
## Alcohol.Consumption, Angry, bedtimeroutine, behaviors,
## Brushing.teeth, cantsleepfeeling, Cigarette.Smoking,
## Daytime.Napping, Daytime.Napping., DistributionChannel,
## Drinking.Caffeinated.beverages, Duration..in.seconds., Exercise,
## Family, Finished, Friends, Frustrated, Guilty,
## Health.care.professional, ID, information, Journaling,
## Listening.to.Music, LocationLatitude, LocationLongitude,
## Meditating, News.sources, None.of.the.above, Other, Other.1,
## Other.online.source, Phone.Usage, Progress, Q1, Q1_consent, Q10,
## Q10_workdayhoursofsleep, Q11, Q11_weekendhoursofsleep, Q12_1,
## Q12_1_howmanynightsusescreen, Q13, Q13_consistentwakeup, Q14_10,
## Q14_10_new_hours, Q14_10_new_minutes, Q14_11, Q14_wakeuptime, Q15,
## Q15_consistentbedtimeonweekdays, Q16_4, Q16_4_new_hours,
## Q16_4_new_minutes, Q16_5, Q16_sleeptime, Q17, Q17_NPS_GROUP,
## Q17_stressedaboutschool, Q18, Q18_howoftenpracticemindfullness,
## Q19, Q19_howmanyhourssdidyouuseascreen, Q2, Q2_5_TEXT, Q2_program,
## Q20, Q3, Q3_role, Q33,
## Q33_whatisthrecommendednumbersofhoursofsleep, Q36, Q36_6_TEXT, Q37,
## Q37_1, Q37_employed, Q37_whatdoyouconsideragoodnightssleep, Q38,
## Q38_wfh, Q39, Q39_dayornight, Q4, Q4_gender, Q42, Q42_10_TEXT,
## Q44_1,
## Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep,
## Q44_2, Q44_2_gettingagoodnightssleepisimportantome, Q44_3,
## Q44_3_mostofmyfriendshaveahealthysleeproutine, Q44_4,
## Q44_4_lackofsleepaffectsmyacademicperformance, Q44_5,
## Q44_5_havingaregularsleeproutineimprovesmentalclariy, Q44_6,
## Q44_6_ifeelpositiveaboutthequalityofmysleep, Q44_7,
## Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep,
## Q44_8, Q44_8_ithinkingworkingoutregularlyleadstobettersleep, Q44_9,
## Q44_9_ithinkmeditatingbeforesleephelpsquality, Q48, Q48_5_TEXT,
## Q49, Q49_sleepqualitychangecovid, Q5, Q5_age, Q5...Parent.Topics,
## Q5...Topics, Q50_1, Q50_1_energyfordailyacitivites, Q50_2,
## Q50_2_attractivness, Q50_3, Q50_3_productivity, Q50_4,
## Q50_4_accomplishmentofotherdailygoals, Q50_5,
## Q50_5_mentalandemotionalwellbeing, Q50_6,
## Q50_6_fosteringmaintaingrelationships, Q50_7,
## Q50_7_caringforchildren, Q52, Q53_1,
## Q53_1_getoutsidefor10mininthemorning, Q53_2,
## Q53_2_exerciseduringtheday, Q53_3,
## Q53_3_doingabreathingexercisebeforesleep, Q53_4,
## Q53_4_notusescreens, Q53_5,
## Q53_5_listeningtoacalmingaudiobookorpodcast, Q59_1,
## Q59_1_icanmaintainhealthysleephabits, Q59_2,
## Q59_2_icancutoutscreenuseonehourbeforesleep, Q59_3,
## Q59_3_icanworkoutregularly, Q59_4, Q59_4_icanmediatebeforebed, Q6,
## Q6_numberinhousehold, Q7, Q7_children, Q8, Q8_3_TEXT, Q8_diagnosis,
## Q9, Q9_howoftensleepy, Reading, Sad, Showering, Social.media,
## Social.Media.Use, Stressed,
## University.wellbeing.resources..Office.of.Wellness.and.Health.Promotion,
## UserLanguage, Using.Sleep.Aids..ex..melatonin, Washing.my.face,
## Watching.TV, X.Benedryl, X.etc., X.etc.., X.Tylenol.PM
Fig 1
ggplot(sleephygiene) +
geom_bar(aes(x=Q3_role), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Role")
Fig 2
ggplot(student) +
geom_bar(aes(x=Q2_program), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("What is your current program at Bloomberg?")
Fig 3
ggplot(student) +
geom_bar(aes(x=Q4_gender), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("What gender do you identify as?")
Fig 4
ggplot(student) +
geom_bar(aes(x=Q37_employed), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Are you currently employed outside of your education program?")
Fig 5
ggplot(employed) +
geom_bar(aes(x=Q38_wfh), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Do you work from home?")
Fig 6
ggplot(notworkfromhome) +
geom_bar(aes(x=Q39_dayornight), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Do you work day or night shifts?")
Fig 7
ggplot(sleephygiene) +
geom_bar(aes(x=Q7_children), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Are there children living in your household?")
Fig 8
ggplot(sleephygiene) +
geom_bar(aes(x=Q8_diagnosis), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Have you ever been diagnosed with any of the following sleep disorders?")
Fig 9
ggplot(sleephygiene) +
geom_bar(aes(x=Q9_howoftensleepy), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("How often do you feel sleepy during the day?")
Fig 10
ggplot(sleephygiene) +
geom_bar(aes(x=Q13_consistentwakeup), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Do you have a consistent time you wake up on weekdays?")
Fig 11
ggplot(sleephygiene) +
geom_bar(aes(x=Q15_consistentbedtimeonweekdays), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Do you have a consistent bedtime on weekdays?")
Fig 12
ggplot(sleephygiene) +
geom_bar(aes(x=Q49_sleepqualitychangecovid), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Has your sleep quality changed due to the COVID-19 pandemic?")
Fig 13
ggplot(sleephygiene) +
geom_bar(aes(x=bedtimeroutine), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("My bedtime routine includes")
Fig 14
ggplot(sleephygiene) +
geom_bar(aes(x=Q17_stressedaboutschool), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("How stressed do you currently feel about school?")
## Warning: Removed 1 rows containing non-finite values (stat_count).
Fig 15
ggplot(sleephygiene) +
geom_bar(aes(x=cantsleepfeeling), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("When you can't sleep do you feel")
Fig 16
ggplot(sleephygiene) +
geom_bar(aes(x=Q18_howoftenpracticemindfullness), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("How often do you practice mindfulness techniques? (i.e. breathing exercises, meditation, etc.,")
Fig 17
ggplot(sleephygiene) +
geom_bar(aes(x=behaviors), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Which of the following behaviors do you participate in? Check all that apply. ")
Fig 18
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("The things I do in the last hour before bed affect the quality of my sleep.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_2_gettingagoodnightssleepisimportantome), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Getting a good night's sleep is important to me.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_3_mostofmyfriendshaveahealthysleeproutine), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Most of my friends have a healthy sleep routine.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_4_lackofsleepaffectsmyacademicperformance), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Lack of sleep affects my academic performance.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_5_havingaregularsleeproutineimprovesmentalclariy), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Having a regular sleep routine improves mental clarity/sharpness.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_6_ifeelpositiveaboutthequalityofmysleep), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I feel positive about the quality of my sleep.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I think cutting out screen use 1 hour before bed leads to better sleep.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_8_ithinkingworkingoutregularlyleadstobettersleep), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I think working out regularly leads to better sleep.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_9_ithinkmeditatingbeforesleephelpsquality), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I think meditating before bed helps sleep quality.")
Fig 19
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_1_icanmaintainhealthysleephabits), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I can maintain healthy sleep habits.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_2_icancutoutscreenuseonehourbeforesleep), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I can cut out screen use 1 hour before bed.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_3_icanworkoutregularly), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I can work out regularly.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_4_icanmediatebeforebed), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I can meditate before bed.")
Fig 20
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_1_energyfordailyacitivites), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Energy for daily activities")
## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_2_attractivness), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Attractiveness (to self & others)")
## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_3_productivity), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Productivity at work/school")
## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_4_accomplishmentofotherdailygoals), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Accomplishment of other daily goals (e.g. exercise, cooking, paying bills, etc)")
## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_5_mentalandemotionalwellbeing), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Mental and emotional wellbeing")
## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_6_fosteringmaintaingrelationships), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Fostering/maintaining relationships")
## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_7_caringforchildren), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Caring for children")
## Warning: Removed 2 rows containing non-finite values (stat_count).
Fig 21
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_1_icanmaintainhealthysleephabits), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I can maintain healthy sleep habits.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_2_icancutoutscreenuseonehourbeforesleep), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I can cut out screen use 1 hour before bed.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_3_icanworkoutregularly), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I can work out regularly.")
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_4_icanmediatebeforebed), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("I can meditate before bed.")
Fig 22
ggplot(sleephygiene) +
geom_bar(aes(x=information), fill="navyblue") +
coord_flip() +
theme_test() +
xlab("Where have you seen or received information about sleep quality or sleep hygiene? Check all that apply. ")